﻿@model KingRoad.EPM.Web.Areas.Device.Models.RoadwayModel
@{
    ViewBag.Title = "车道信息列表";
}
@using KingRoad.EPM.Common.Helper
@using (Html.BeginForm("SplitPage", "Roadway", null, FormMethod.Post, new { id = "pagerForm", onsubmit = "return divSearch(this,'cdxx_list');" }))
{
    <input type="hidden" name="pageNum" value="1" />
    <input type="hidden" name="numPerPage" value="@(ViewBag.numPerPage)" />
    <input type="hidden" name="input_placId" value="@(ViewBag.PlacId)" />
    <ul class="searchBar">
        <li><span>车道名：</span>
            <input type="text" name="iput_name" value="@(ViewBag.iput_name)" />
        </li>
        <li><span>车道编号：</span>
            <input type="text" name="iput_code" value="@(ViewBag.iput_code)" />
             <input type="hidden" name="Code" value="@(ViewBag.Code)" />
        </li>
        <li>
            <button type="submit" class="btn btn-success btn-xs">
                搜索</button>
        </li>
    </ul>
}
<div class="panelBar" style="border-top: none;">
  @if (ViewBag.Code=="SFZ")
  {
 
      <ul class="toolBar">
        <li>
            @Html.PermissionButton("Device.Roadway.Create", "Device_Roadway_Create", Url.Action("Create", "Roadway", new { placId = ViewBag.PlacId }), "添加"
             , new Dictionary<string, object> { { "class", "add" }, { "rel", "roadway_add" }, { "mask", "true" }, { "target", "dialog" }, { "width", "400" }, { "height", "300" } })
        </li>
        <li>
            @Html.PermissionButton("Device.Roadway.Edit", "Device_Roadway_Edit", Url.Action("Edit", "Roadway", new { id = "{ids}" }), "修改"
             , new Dictionary<string, object> { { "class", "edit" }, { "rel", "roadway_edit" }, { "mask", "true" }, { "target", "dialog" }, { "width", "400" }, { "height", "300" },{"warn","请选择一条信息!"} })
        </li>
        <li>
            @Html.PermissionButton("Device.Roadway.Delete", "Device_Roadway_Delete", Url.Action("Delete", "Roadway", new { id = "{ids}" }), "删除"
             , new Dictionary<string, object> { { "class", "delete" },{"title","确定要删除这条记录吗?"},{"target","ajaxTodo"},{"callback","function(){$('#pagerForm', navTab.getCurrentPanel()).submit();}"}})
        </li>
        <li class="line">line</li>
        <li>
            @Html.PermissionButton("Device.Roadway.Download", "Device_Roadway_Download",
                             "../../Areas/Device/Upload/车道信息表.xls",
                    "模板",
                    new Dictionary<string, object>
                    {
                        {"class","download"},{"targettype","navTab"} ,{"title","导入模板下载"}
                    })
        </li>
        <li>
            @Html.PermissionButton("Device.Roadway.Input", "Device_Roadway_Input",
                    Url.Action("Index", "Import", new { url = "/Roadway/ImportExcelFile", Section = ViewBag.PlacId }),
                    "导入",
                    new Dictionary<string, object>
                    {
                        {"class","input"},{"rel","tzgl_slry_input"} ,{"lookupgroup","attachment"},{"width","320"},{"height","320"},{"title","导入EXCEL"}
                    })
        </li>
        <li>
            @Html.PermissionButton("Device.Roadway.Export", "Device_Roadway_Export",
                    Url.Action("Excel", "Roadway", new { PlacId = ViewBag.PlacId, danwei = ViewBag.danwei }),
                    "导出",
                    new Dictionary<string, object>
                    {
                        {"class","export"} ,{"targettype","navTab"},{"title","导出EXCEL"}
                    })
        </li>
    </ul>
           
  }
</div>


<table class="table" width="100%" layouth="124" nowraptd="false" aria-relevant="cdxx_list">
    <thead>
        <tr>
            <th width="22" style="display: none">
                <input type="checkbox" group="ids" class="checkboxCtrl" />
            </th>
            <th width="30" align="center">序号
            </th>
            <th width="80" align="center">车道
            </th>
            <th width="40" align="center">车道编号
            </th>
            <th width="80" align="center">仪表编号
            </th>
            <th width="80" align="center">仪表型号
            </th>
             <th width="30" align="center">操作
            </th>
        </tr>
    </thead>
    <tbody>
        @{ int num = (ViewBag.pageNum - 1) * ViewBag.numPerPage;}
        @foreach (var item in Model.list)
        {
            num += 1;
            <tr target="ids" rel="@item.Id">
                <td style="display: none">
                    <input name="ids" value="@item.Id" type="checkbox">
                </td>
                <td>@num
                </td>
                <td align="center">
                    <a style="color:#000" href="@Url.Action("Detail", "Roadway", new { id = item.Id })" rel="tzgl_zyry_detail" mask="true" target="dialog" width="480" height="320">@item.RName</a>
                </td>
                <td align="center">@item.Code
                </td>
                <td align="center">@item.MeterCode
                </td>
                <td align="center">@item.Model
                </td>
                 <td width="30" align="center">@if (item.RoadId==0)
                                              {
                                                      <a class="btn btn-min" href="@Url.Action("IndexQuery", "Meter", new { roadId = item.Id })" lookupgroup="list" title="选择仪表">仪表绑定</a>
                     
                                              }
                                              else
                                              {
                                                    @Html.PermissionButton("Device.Meter.UNBinding", "Device_Meter_UNMeterBinding",
                 Url.Action("UNMeterBinding", "Meter", new { meterid = @item.MeterId }), 
                 "解除绑定",
                 new Dictionary<string, object> {
                 { "class", "btn btn-min" },{"title","确定解除绑定这条记录吗?"},{"target","ajaxTodo"},{"callback","function(){$('#pagerForm', navTab.getCurrentPanel()).submit();}"}
                 })
                                                  
                                                
                                              }
                </td>
            </tr>
               
        }
    </tbody>
</table>
<div class="panelBar" style="border-bottom: none;">
    <div class="pages" style="float: right">
        <span>显示</span>
        <select class="comsplitpage" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value},'cdxx_list')">
            <option value="10" @(ViewBag.numPerPage == 10 ? "selected='selected'" : "")>10</option>
            <option value="20" @(ViewBag.numPerPage == 20 ? "selected='selected'" : "")>20</option>
            <option value="50" @(ViewBag.numPerPage == 50 ? "selected='selected'" : "")>50</option>
        </select>
        <span>条，共@(ViewBag.pagenumshown)页,@(ViewBag.totalcount)条</span>
    </div>
    <div class="pagination" style="margin:0px;float:left; margin-left:35%" rel="cdxx_list" totalcount="@(ViewBag.totalcount)" numperpage="@(ViewBag.numPerPage)" pagenumshown="10" currentpage="@(ViewBag.pageNum)">
    </div>
</div>
